package com.edu.app.service.impl.core;

import com.edu.app.bean.core.SysContract;

import com.edu.app.mapper.core.SysContractMapper;
import com.edu.app.model.customer.ContractModel;
import com.edu.app.service.impl.SysBaseServiceImpl;
import com.edu.app.service.sys.core.SysContractService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysContractServiceImpl extends SysBaseServiceImpl<SysContract,SysContractMapper> implements SysContractService {
    @Autowired
    SysContractMapper sysContractMapper;

    @Override
    public List<SysContract> GetContractByCustomerId(Integer id){
        return sysContractMapper.GetContractByCustomerId(id);
    }

    @Override
    public Integer deleteContractByCustomerId(Integer id){
        return sysContractMapper.deleteContractByCustomerId(id);
    }

    @Override
    public List<ContractModel> getContractModelByCusId(Integer id){
        return sysContractMapper.getContractModelByCusId(id);
    }

    @Override
    public ContractModel getContractModelByModelId(Integer id){
        return sysContractMapper.getContractModelByModelId(id);
    }

    @Override
    public PageInfo getContractModelByCusIdAndPages(Integer id, Integer currentPage, Integer pageSize){
        PageHelper.startPage(currentPage, pageSize, true);

        List<ContractModel> list = sysContractMapper.getContractModelByCusId(id);

        PageInfo<ContractModel> pageInfo = new PageInfo<ContractModel>(list);
        return pageInfo;
    }
}

